package model

import (
	"gddgame.cc/galaxy/common/dsl/db"
	"gddgame.cc/galaxy/common/dsl/game"
	"gddgame.cc/galaxy/common/dsl/game/user"
)

var (
	SettingTaskModel *db.Table
	UserModel        *db.Table
	UserItemModel    *db.Table
	ZoneNodeModel    *db.Table

	Provider = game.ModuleProvider{
		Name:    "star",
		Depends: []string{"ad", "ai", "attr", "badge", "config", "object", "group", "item", "reward", "stat", "task", "target", "skill", "user"},
		OnInit: func(env *game.Environment) error {
			var err error
			if UserModel, err = env.RegisterModel(user.UserName, DefaultUser); err != nil {
				return err
			}
			if UserItemModel, err = env.RegisterModel(user.UserItemName, &UserItem{}); err != nil {
				return err
			}
			if SettingTaskModel, err = env.RegisterModel(SettingTaskName, &SettingTask{}); err != nil {
				return err
			}
			if ZoneNodeModel, err = env.RegisterModel(ZoneNodeName, &ZoneNode{}); err != nil {
				return err
			}
			return nil
		},
	}
)
